<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
    <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
<script type="text/javascript" src="js/jquery-1.8.3.js"></script>
<script type="text/javascript">
	$(function(){
		$("tr:even").css("backgroundColor","#9f9f9f");
		$("tr:first").css("backgroundColor","#6f6f6f");
	});
	function dele(id) {
		if (confirm("确认删除该考勤记录?")) {
			$.getJSON("DeleServlet","id="+id,function(data){
				if (data.count>0) {
					alert("删除成功");
					location.href="ListServlet";
				}else{
					alert("删除失败");
				}
			});
		}else{
			alert("您取消了删除");
		}
		
	}
</script>
<c:if test="${empty list }">
	<c:redirect url="ListServlet"></c:redirect>
</c:if>
</head>
<body>
<center>
	<h2>考勤信息记录表</h2>
	<table border="1">
		<tr>
			<th>员工姓名</th>
			<th>所属部门</th>
			<th>考勤日期</th>
			<th>考勤状态</th>
			<th>操作</th>
		</tr>
		<c:forEach items="${requestScope.list }" var="temp">
		<tr>
			<td>${temp.empName }</td>
			<td>${temp.dept }</td>
			<td>${temp.chkDate }</td>
			<td>${temp.status }</td>
			<td><a href="javascript:dele(${temp.id })">删除</a></td>
		</tr>
		</c:forEach>
	</table>
	<a href="AttenceAdd.jsp">考勤登记</a>
</center>
</body>
</html>